//
//  PopingView.m
//  Civacrm
//
//  Created by zhk on 2017/2/20.
//  Copyright © 2017年 王桂敏. All rights reserved.
//
#define kSpaceLeft 10

#import "PopingView.h"

@implementation PopingView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self popingViewShow];
    }
    return self;
}
- (void)popingViewShow
{
 
    self.view = [UIView viewWithFrame:self.bounds bgColor:BlackColor];
    self.view.alpha = 0.5;
    [self addSubview:self.view];
    
    self.BoxBackgroundImage = [[UIImageView alloc]initWithFrame:CGRectMake(kSpaceLeft, kScreenHeight * 0.35, kScreenWidth -kSpaceLeft * 2, 150 * SizeZoom)];
    self.BoxBackgroundImage.image = Image(@"tankuang_huanying");
    self.BoxBackgroundImage.userInteractionEnabled = YES;
    
    self.BoxContentLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth * 0.35, 50 * SizeZoom, 130 * SizeZoom, 70 * SizeZoom)];
    self.BoxContentLabel.numberOfLines = 0;
    self.BoxContentLabel.textColor = ColorWithHexString(@"468bb8");
    self.BoxContentLabel.font = font(22);
    self.BoxContentLabel.text = [NSString stringWithFormat:@"尊敬的%@:\n \n 恭喜您加入Civa的大家庭，一大波优质的服务等待您的发现。",self.nickName];
    self.BoxContentLabel.userInteractionEnabled = YES;
    
    self.BoxLookBtn = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.BoxBackgroundImage.frame) - 50 * SizeZoom - kSpaceLeft * 2, CGRectGetHeight(self.BoxBackgroundImage.frame) - kSpaceLeft - 30 * SizeZoom, 50 * SizeZoom, 30 * SizeZoom)];
    [self.BoxLookBtn setImage:Image(@"btn_look") forState:(UIControlStateNormal)];
    [self.BoxLookBtn addTarget:self action:@selector(deleteView) forControlEvents:(UIControlEventTouchUpInside)];
    
    self.BoxCloseBtn = [[UIButton alloc]initWithFrame:CGRectMake( kScreenWidth - kSpaceLeft * 2 - 40 * SizeZoom , CGRectGetMinY(self.BoxContentLabel.frame) - 15 , 40 * SizeZoom, 40 * SizeZoom)];
    [self.BoxCloseBtn addTarget:self action:@selector(deleteView) forControlEvents:(UIControlEventTouchUpInside)];
    [self addSubview:self.BoxBackgroundImage];
    [self.BoxBackgroundImage addSubview:self.BoxContentLabel];
    [self.BoxBackgroundImage addSubview:self.BoxCloseBtn];
    [self.BoxBackgroundImage addSubview:self.BoxLookBtn];
    
}

- (void)deleteView
{
    [self removeFromSuperview];
}





@end
